package cn.iocoder.yudao.module.blog.dal.mysql.casecomment;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.controller.app.jiucase.vo.commentvo.AppBlogCaseCommentPageReqVO;
import cn.iocoder.yudao.module.blog.controller.app.post.commentvo.AppBlogPostCommentPageReqVO;
import cn.iocoder.yudao.module.blog.dal.dataobject.casecomment.BlogCaseCommentDO;
import cn.iocoder.yudao.module.blog.dal.dataobject.postcomment.BlogPostCommentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.casecomment.vo.*;

/**
 * 案例评论 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogCaseCommentMapper extends BaseMapperX<BlogCaseCommentDO> {

    default PageResult<BlogCaseCommentDO> selectPage(BlogCaseCommentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogCaseCommentDO>()
                .eqIfPresent(BlogCaseCommentDO::getMemberId, reqVO.getMemberId())
                .betweenIfPresent(BlogCaseCommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogCaseCommentDO::getId));
    }

    default List<BlogCaseCommentDO> selectList(BlogCaseCommentExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogCaseCommentDO>()
                .eqIfPresent(BlogCaseCommentDO::getMemberId, reqVO.getMemberId())
                .betweenIfPresent(BlogCaseCommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogCaseCommentDO::getId));
    }

    default PageResult<BlogCaseCommentDO> appSelectPage(AppBlogCaseCommentPageReqVO reqVO){
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogCaseCommentDO>()
                .eqIfPresent(BlogCaseCommentDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(BlogCaseCommentDO::getCaseId, reqVO.getCaseId())
                .eqIfPresent(BlogCaseCommentDO::getMainCommentId, reqVO.getMainCommentId())
                .orderByDesc(BlogCaseCommentDO::getId));
    }

}
